home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / music and sound / soundsnippets / soundsnippets.h < prev   
Encoding:
Text File  |  2000-06-23  |  2.9 KB  |  87 lines

  1. //////////
  2. //
  3. //    File:        SoundSnippets.h
  4. //
  5. //    Contains:    Code snippets showing how to perform a few typical sound-related operations.
  6. //
  7. //    Written by:    Tim Monroe
  8. //                Some routines based on code by Jim Reekes.
  9. //
  10. //    Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  11. //
  12. //    Change History (most recent first):
  13. //
  14. //       <1>         04/17/98    rtm        first file
  15. //     
  16. //////////
  17.  
  18. #ifndef __MACTYPES__
  19. #include <MacTypes.h>
  20. #endif
  21.  
  22. #ifndef __cmath__
  23. #include <Math.h>
  24. #endif
  25.  
  26. #ifndef __FIXMATH__
  27. #include <FixMath.h>
  28. #endif
  29.  
  30. #ifndef __MOVIES__
  31. #include <Movies.h>
  32. #endif
  33.  
  34. #ifndef __QUICKTIMECOMPONENTS__
  35. #include <QuickTimeComponents.h>
  36. #endif
  37.  
  38. #ifndef __RESOURCES__
  39. #include <Resources.h>
  40. #endif
  41.  
  42. #ifndef __SOUND__
  43. #include <Sound.h>
  44. #endif
  45.  
  46. #ifndef __SCRIPT__
  47. #include <Script.h>
  48. #endif
  49.  
  50. // constants
  51. #define kNoWait                        true
  52. #define kWait                        false
  53. #define kNumberOfBufferChunks        10
  54. #define kNumberOfCmdsInQueue        8
  55. #define kSampleResourceID            2222
  56.  
  57. #define kNumberOfTargetBytes        (40*1024L)
  58.  
  59. #define kSaveSoundPrompt            "Save sound file as:"
  60. #define kSaveSoundWaveName            "Untitled.wav"
  61. #define kSaveSoundFileName            "Untitled"
  62.  
  63.  
  64. // function prototypes
  65. void                        SndSnip_SaveSoundMovieAsWAVEFile (Movie theMovie);
  66. void                        SndSnip_SaveSoundMovieAsAnyTypeFile (Movie theMovie);
  67. void                        SndSnip_SaveSoundTrackAsAnyTypeFile (Movie theMovie);
  68. void                        SndSnip_ExtractSoundTrackIntoHandle (Movie theMovie);
  69. void                        SndSnip_PlayWAVEFileWithQuickTime (void);
  70. void                        SndSnip_SetVolumeOfSoundTrack (Movie theMovie, short theVolume);
  71. OSErr                        SndSnip_PlaySoundResourceUsingBufferCmds (void);
  72. PASCAL_RTN void                SndSnip_CallbackProc (SndChannelPtr theChannel, SndCommand *theCommand);
  73. void                        SndSnip_CheckBuffers (void);
  74. static OSErr                SndSnip_InstallBufferCmd (SndChannelPtr theChannel, SoundHeaderPtr theHeaderPtr);
  75. static OSErr                SndSnip_InstallCallbackCmd (SndChannelPtr theChannel, short theParam1, long theParam2);
  76. SoundHeaderPtr                SndSnip_GetSoundHeader (Handle theSndHandle);
  77. long                        SndSnip_GetSndBaseFrequency (Handle theSndHandle);
  78. OSErr                        SndSnip_GetHardwareSettings (SndChannelPtr theChannel, SoundComponentData *theInfo);
  79. OSErr                        SndSnip_GetAudioSettings (Movie theMovie, SoundComponentData *theInfo);
  80. Boolean                        SndSnip_HasSoundManager3_1 (void);
  81. Boolean                        SndSnip_CheckVersionNumber (const NumVersion *theVersion, UInt8 theMajor, UInt8 theMinor, UInt8 theBug);
  82. OSErr                        SndSnip_GetVolume (SndChannelPtr theChannel, unsigned short *theLeftVol, unsigned short *theRightVol);
  83. OSErr                        SndSnip_SetVolume (SndChannelPtr theChannel, unsigned short theLeftVol, unsigned short theRightVol);
  84. OSErr                        SndSnip_ConvertWAVEFormats (Movie theMovie, FSSpec *theFile);
  85. void                        SndSnip_PromptUserForAudioFileAndCompress (void);
  86. void                        SndSnip_PromptUserForDiskFileAndSaveCompressed (short theSrcRefNum, SoundComponentData *theSrcInfo, SoundComponentData *theDstInfo, unsigned long theSrcDataOffset, unsigned long theSrcNumFrames);
  87.